package org.mspring.mlog.dao.impl;

import org.mspring.mlog.dao.CatalogDao;
import org.mspring.mlog.entity.Catalog;
import org.mspring.platform.dao.hibernate.GenericDao;
import org.springframework.stereotype.Repository;

/**
 *
 * @author Gao Youbo
 * @since 2014-01-11
 */
@Repository
public class CatalogDaoImpl extends GenericDao<Catalog, Long> implements CatalogDao {

    @Override
    public void setSort(Long id, Long sort) {
        executeUpdate("update Catalog c set c.sort = ? where c.id = ?", sort, id);
    }

    @Override
    public Catalog findByName(String name) {
        return super.uniqueResult("select c from Catalog c where c.name = ?", name);
    }

}
